package  
{
	import flash.display.DisplayObject;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.geom.Rectangle;
	/**
	 * ...
	 * @author Harry
	 */
	public class test extends Sprite
	{
		private var _square:Sprite;
		private var _child:Sprite;
		
		public function test() 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event=null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			
			_square = new Sprite();
			_square.graphics.beginFill(0x000000, 0.4);
			_square.graphics.drawRect(0, 0, 300, 300);
			addChild(_square);
			applyNaturalScrollRect(_square);
			
			_child = new Sprite();
			_child.graphics.beginFill(0xFF8000, 1);
			_child.graphics.drawRect(0, 0, 100, 100);
			_square.addChild(_child);
			_child.addEventListener(Event.ENTER_FRAME, _onEnterFrame, false, 0, true);
		}
		
		private function _onEnterFrame(e:Event):void 
		{
			_child.x = mouseX;
			_child.y = mouseY;
		}
		
		public function applyNaturalScrollRect(dispObj:DisplayObject): void
		{
			dispObj.scrollRect = new Rectangle(0, 0, dispObj.width, dispObj.height);
		}
		
	}

}